package nowCoder;

import java.math.BigInteger;
import java.util.Scanner;

public class HJ33 {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        String x = in.next();
        String y = in.next();
        String[] xx = x.split("\\.");
        StringBuilder sb = new StringBuilder();
        for (String s : xx) {
            int n = Integer.parseInt(s);
            for (int j = 7; j >= 0; j--) {
                sb.append((n & (1 << j)) > 0 ? "1" : "0");
            }
        }
        System.out.println(Long.parseLong(String.valueOf(sb),2));
        long yy = Long.parseLong(y);
        StringBuilder sb2 = new StringBuilder();
        for (int j = 31; j >= 0; j--) {
            sb2.append((yy & (1 << j)) > 0 ? "1" : "0");
        }
        System.out.print(Integer.parseInt(sb2.substring((0*8),(0+1)*8),2)+".");
        System.out.print(Integer.parseInt(sb2.substring((1*8),(1+1)*8),2)+".");
        System.out.print(Integer.parseInt(sb2.substring((2*8),(2+1)*8),2)+".");
        System.out.print(Integer.parseInt(sb2.substring((3*8),(3+1)*8),2));
    }
}
